package com.example.vue20220225.controller;


import com.example.vue20220225.model.CheckPower;
import com.example.vue20220225.model.Power;
import com.example.vue20220225.model.Role;
import com.example.vue20220225.model.UserInfo;
import com.example.vue20220225.service.RoleService;
import com.example.vue20220225.service.UserService;
import com.example.vue20220225.util.MyEmail;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Resource
    RoleService roleService;

    @RequestMapping("/addrole")
    public Map<String,Object> addrole(Role role){
        return roleService.add(role);
    }
    @RequestMapping("/editrole")
    public Map<String,Object> editrole(Role role){
        return roleService.editrole(role);
    }
    @RequestMapping("/deleterole")
    public Map<String,Object> deleterole(Role role){
        return roleService.deleterole(role.getRoleId());
    }
    @RequestMapping("/powerselectlist")
    public Map<String,Object> powerselectlist(Role role){
        return roleService.powerselectlist(role.getRoleId());
    }
    @RequestMapping("/editpowerist")
    public Map<String,Object> editpowerist(CheckPower checkPower){
        System.out.println(checkPower);
        return roleService.editpowerist(checkPower);
    }

}
